Robotics 1.0 Lesson Plan
Lesson 4: Shake-o-meter.

Purpose:Implement a simple lighting game to control the Neopixels based on the tilt of the accelerometer.

No. of. Classes

1 - (Time : 1:30 minutes, Each group maximum 4 children).

Materials Required
  • Desktop or Laptop computer
  • CPX Board
  • USB Cable - Micro USB
Prior knowledge
  • Familiarity with the CPX board
  • Basic Python coding using Mu Editor
  • Connecting CPX to a computer using a USB cable and Booting in CircuitPY Mode
Exercises

Exercise:1



Introduction to for loop in Python (with CPX NeoPixels)

Click here to view the instructions and code

Exercise:2



Tilt Detection using the accelerometer.

Click here to view the instructions and code



Exercise:3



Control Neopixel lights using the tilt of the CPX board.

Click here to view the pseudocode

Solution



  • Click here to see the solution video for Exercise 1
  • Click here to see the solution Document for Exercise 3
  • Click here to see the solution video for Exercise 3
  • Teacher's Instruction
    1. Introduce the objective of the activity.
    2. Ensure required materials are ready (CPX, USB cable, Mu Editor).
    3. Give a simple explanation of how the accelerometer works. Recap with the help of what of they learnt in Physical Computing course
    4. Help students write and upload the full Python code step-by-step.
    5. Give Step-by-step instructions to demonstrate and troubleshoot.
    6. Provide optional extensions (changing colors, adding sound, scoring game, etc)
    7. Where have you seen accelerometers used in real life?